﻿using System;
using System.Collections.Generic;
using System.Data.OleDb;
using System.Linq;
using System.Text;

namespace VIFON.DAL
{
    public class DAPaymentType
    {
        internal List<PaymentType> GetPaymentTypes()
        {
            try
            {
                using (var db = new DBVIFONDataContext())
                {
                    var temp = db.PaymentTypes;
                    return temp.Count() > 0 ? temp.ToList() : null;
                }
            }
            catch
            {
                return null;
            }
        }

        internal PaymentType GetPaymentType(int id)
        {
            try
            {
                using (var db = new DBVIFONDataContext())
                {
                    return db.PaymentTypes.FirstOrDefault(o => o.Id == id);
                }
            }
            catch
            {
                return null;
            }
        }
    }
}
